<?php
// +----------------------------------------------------------------------
// | genadmin [ genadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\admin\validate\order;

use think\Validate;

/**
 * 文档订单验证器
 */
class OrderValidate extends Validate
{
    /**
     * 定义验证规则
     */
    protected $rule =   [
        'order_no' => 'require',
        'total_price' => 'require',
        'pay_price' => 'require',
        'pay_status' => 'require',
        'pay_time' => 'require',
        'transaction_id' => 'require',
        'user_id' => 'require',
        'create_time' => 'require',
        'update_time' => 'require',
        'order_type' => 'require',
        'pay_type' => 'require',
        'client_type' => 'require',
        'is_distribution' => 'require',
        'distribution_user_id' => 'require',
        'order_status' => 'require',
        'coupons_id' => 'require',
    ];

    /**
     * 定义错误信息
     */
    protected $message  =   [
        'order_no' => '订单号必须填写',
        'total_price' => '商品总金额必须填写',
        'pay_price' => '实付款金额必须填写',
        'pay_status' => '付款状态必须填写',
        'pay_time' => '付款时间必须填写',
        'transaction_id' => '支付交易号必须填写',
        'user_id' => '用户id必须填写',
        'create_time' => '创建时间必须填写',
        'update_time' => '更新时间必须填写',
        'order_type' => '订单类型必须填写',
        'pay_type' => '支付方式必须填写',
        'client_type' => '客户端必须填写',
        'is_distribution' => '分销订单必须填写',
        'distribution_user_id' => '分销员ID必须填写',
        'order_status' => '订单状态必须填写',
        'coupons_id' => '优惠卷ID必须填写',
    ];

    /**
     * 定义场景
     */
    protected $scene = [
        'save' => [
            'order_no',
            'total_price',
            'pay_price',
            'pay_status',
            'pay_time',
            'transaction_id',
            'user_id',
            'create_time',
            'update_time',
            'order_type',
            'pay_type',
            'client_type',
            'is_distribution',
            'distribution_user_id',
            'order_status',
            'coupons_id',
        ],
        'update' => [
            'order_no',
            'total_price',
            'pay_price',
            'pay_status',
            'pay_time',
            'transaction_id',
            'user_id',
            'create_time',
            'update_time',
            'order_type',
            'pay_type',
            'client_type',
            'is_distribution',
            'distribution_user_id',
            'order_status',
            'coupons_id',
        ],
    ];

}
